﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace NewsSpider.App
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            if (false == NewsSpider.Utility.SingleInstance.HandleRunningInstance())
            {
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new MainFrm());//软件主界面
                //Application.Run(new LoginFrm());//软件登陆验证，如果不需要直接从MainFrm启动软件
            }
        }

        static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            NewsSpider.Utility.Log.SaveSpecialErrorLog("Cloudin Window Form：" + e.Exception.Message);
        }

        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            NewsSpider.Utility.Log.SaveSpecialErrorLog("Cloudin Not Window Form：" + e.ToString());
        }
    }
}
